package main

import "fmt"

type Animal interface {
	Sleep()
	Eating()
}

type Cat struct {
	Color string
}

type Dog struct {
	Color string
}

func (c Cat) Sleep() {
	fmt.Println(c.Color, "cat is sleep")
}

func (c Cat) Eating() {
	fmt.Println(c.Color, "cat is eating")

}

func (c Dog) Sleep() {
	fmt.Println(c.Color, "dog is sleep")
}

func (c Dog) Eating() {
	fmt.Println(c.Color, "dog is eating")

}
func (c Dog) print() {
	fmt.Println("dog's color is ", c.Color)

}

func Factory(color string, animal string) Animal {
	switch animal {
	case "dog":

		return &Dog{color}
	case "cat":
		return &Cat{color}
	default:
		return nil
	}
}
func main() {
	d1 := Factory("black", "dog")
	d1.Eating()
	d2 := Factory("white", "cat")
	d2.Sleep()

}
